Neste projeto são elaborados Modelos de Distribuição de Espécies (MDE) para peixes do gênero Anablepsoides (Cryprinodontiformes: Rivulidae) na Amazônia brasileira.
Anablepsoides são pequenos peixes rivulídeos não anuais, fortemente associados a florestas tropicais úmidas, com distribuição majoritária na Amazônia. Das aproximadamente 50 espécies válidas, apenas três não ocorrem nesse bioma. A grande maioria dessas espécies possui poucos dados de ocorrência disponíveis, sendo muitas delas recentemente descritas.
Este grupo se distribui em pequenos córregos, alagados ou poças, podendo até sair da água e se deslocar entre diferentes corpos d’água, realizando saltos no ambiente terrestre, em busca de novas áreas para reprodução ou recursos alimentares. Por isso, é considerado um grupo de peixes anfíbios. Assim, as espécies de Anablepsoides não são encontradas exclusivamente próximas a grandes rios, habitando diversos tipos de corpos d’água disponíveis. Até o momento, não foi identificado um padrão claro de distribuição que defina a presença desses peixes dentro das florestas tropicais.
Dessa forma, este estudo tem como objetivo avaliar a distribuição de Anablepsoides por meio de Modelos de Distribuição de Espécies (MDE) na Amazônia brasileira, buscando identificar a área de distribuição do gênero e os principais fatores bioclimáticos que a explicam.
- H1: Fatores bioclimáticos específicos limitam a distribuição das espécies do gênero Anablepsoides dentro da Amazônia, indicando que apenas determinadas áreas do bioma são adequadas para sua presença.
# funcao para instalar pacotes se ainda não estao instalados
install_pack <- function(x){
new.packages <- x[!(x %in% installed.packages()[,"Package"])]
if(length(new.packages)) install.packages(new.packages)
}
pacotes <- c(
"tidyverse",
"rnaturalearth",
"rnaturalearthdata",
"nngeo",
"sf",
"tmap",
"spocc",
"CoordinateCleaner",
"spThin",
"mapview",
"mapedit",
"raster",
"viridis",
"usdm",
"ENMTools",
"geodata",
"ade4",
"robis",
"here",
"sdmpredictors",
"geobr",#Official Spatial Data Sets of Brazil
"tools",
"sp",
"biomod2",
"janitor",
"tidyterra",
"pROC"
)
install_pack(pacotes)
for(i in pacotes){
eval(bquote(library(.(i))))
}
sf::sf_use_s2(use_s2 = FALSE)
select <- dplyr::select
dir.create("dados")
dir.create("dados/ocorrencias")
dir.create("dados/variaveis")
dir.create("dados/shapefiles")
biomas_br <- read_biomes()
## Using year/date 2019
amazonia <- subset(biomas_br, biomas_br$name_biome == "Amazônia")
#plot
tm_shape(amazonia) +
tm_polygons()
Pelas descrições de habitat do grupo de estudo e por ele ser amplamente distribuído no bioma. Foi escolhida a delimitação de todo bioma Amazônia dentro do Brasil.
Os dados de ocorrências utilizados neste projeto foram obtidos através de um longo processo de consulta em acervos científicos, periódicos, amostragens e também do GBIF.
Esses dados fazem parte da pesquisa de doutorado e já estavam planilhados anteriormente.
occ_data <- read.csv("./dados/ocorrencias/occ_anablepsoides.csv",
header = T,
sep = ";", encoding = "UTF-8")
occ_data <- occ_data %>%
rename(
sp = Espécie,
latitude = Latitude,
longitude = Longitude,
lote = Lote
) %>%
mutate(longitude = as.numeric(longitude),
latitude = as.numeric(latitude))
# Remover NAs
occ_data <- occ_data %>%
drop_na(longitude, latitude)
occ_data_vector <- st_as_sf(occ_data, coords = c("longitude", "latitude"), crs = 4326)
occ_data_vector <- occ_data %>%
tidyr::drop_na(longitude, latitude) %>%
dplyr::mutate(lon = longitude, lat = latitude) %>%
sf::st_as_sf(coords = c("lon", "lat"), crs = 4326)
#visualizar
# map
tm_shape(amazonia) +
tm_polygons() +
tm_shape(occ_data_vector) +
tm_dots(size = .2, shape = 21, col = "steelblue") +
tm_graticules(lines = FALSE) +
tm_view(bbox = c(xmin = -74, xmax = -34, ymin = -33, ymax = 5))
A filtragem foi de grande importância, pois, como os dados foram compilados a partir de coleções científicas e amostragens de campo, frequentemente são catalogados inúmeros espécimes ou lotes de indivíduos para uma mesma localidade. O processo de remoção de dados duplicados foi essencial.
A filtragem por distância espacial também resultou em uma redução significativa dos dados, sendo crucial para evitar o enviesamento dos modelos. Foi definida uma distância mínima de 50 km entre cada ocorrência.
-Aqui foram removidas as ocorrências de outros biomas (cerrado, amazônia e caatinga) e fora dos limites do brasil.
# crop to limit
st_crs(amazonia) <- 4326
occ_data_sptlim <- st_intersection(occ_data_vector, amazonia)
## although coordinates are longitude/latitude, st_intersection assumes that they are planar
occ_data_sptlim
## Simple feature collection with 357 features and 7 fields
## Geometry type: POINT
## Dimension: XY
## Bounding box: xmin: -72.71667 ymin: -12.21028 xmax: -43.9705 ymax: 2.584111
## Geodetic CRS: WGS 84
## First 10 features:
## lote sp latitude longitude name_biome
## 16 UFRN 4729 Anablepsoides sp. -0.931861 -48.09692 Amazônia
## 17 UFRN 5002 Anablepsoides sp. -0.931861 -48.09692 Amazônia
## 18 UFRN 5768 Anablepsoides sp. 2.584111 -50.88047 Amazônia
## 19 MPEG.ICT 027856 Anablepsoides urophthalmus -5.000000 -57.15000 Amazônia
## 20 \tMPEG.ICT 023420 Anablepsoides urophthalmus -1.788889 -51.62556 Amazônia
## 21 MPEG.ICT 027950 Anablepsoides urophthalmus -5.700000 -57.60000 Amazônia
## 22 \tMPEG.ICT 036343 Anablepsoides urophthalmus -6.336389 -49.87278 Amazônia
## 23 MPEG.ICT 030519 Anablepsoides urophthalmus -2.601389 -48.94194 Amazônia
## 24 FLMNH Ichthyology 189590 Anablepsoides urophthalmus -1.851167 -54.05544 Amazônia
## 25 FLMNH Ichthyology \t188903 Anablepsoides urophthalmus -1.851167 -54.05544 Amazônia
## code_biome year geometry
## 16 1 2019 POINT (-48.09692 -0.931861)
## 17 1 2019 POINT (-48.09692 -0.931861)
## 18 1 2019 POINT (-50.88047 2.584111)
## 19 1 2019 POINT (-57.15 -5)
## 20 1 2019 POINT (-51.62556 -1.788889)
## 21 1 2019 POINT (-57.6 -5.7)
## 22 1 2019 POINT (-49.87278 -6.336389)
## 23 1 2019 POINT (-48.94194 -2.601389)
## 24 1 2019 POINT (-54.05544 -1.851167)
## 25 1 2019 POINT (-54.05544 -1.851167)
occ_data_sptlim <- occ_data_sptlim %>%
dplyr::select(names(occ_data_vector))
#map
plot(st_geometry(amazonia), col = "lightgreen", border = "darkgreen") +
plot(st_geometry(occ_data_sptlim), col = "blue", add = TRUE)
## integer(0)
-Observa-se que muitas ocorrências são sobrepostas e agrupadas em determinados locais, logo, precisam ser triadas
-Aqui foram removidas as ocorrências duplicadas, com lat e long iguais e localizadas no mar.
# flag data
occ_data_sptlim_bias <- CoordinateCleaner::clean_coordinates(
x = sf::st_drop_geometry(occ_data_sptlim),
species = "sp",
lon = "longitude",
lat = "latitude",
outliers_mtp = 2,
value = "clean",
tests = c("duplicates",
"equal",
"seas",
"zeros"
)) %>%
tibble::as_tibble() %>%
dplyr::mutate(lon = longitude, lat = latitude) %>%
sf::st_as_sf(coords = c("lon", "lat"), crs = 4326)
## Testing coordinate validity
## Flagged 0 records.
## Testing equal lat/lon
## Flagged 0 records.
## Testing zero coordinates
## Flagged 0 records.
## Testing sea coordinates
## Reading layer `ne_50m_land' from data source
## `C:\Users\Salu Coêlho\AppData\Local\Temp\RtmpI5liAy\ne_50m_land.shp' using driver `ESRI Shapefile'
## Simple feature collection with 1420 features and 3 fields
## Geometry type: MULTIPOLYGON
## Dimension: XY
## Bounding box: xmin: -180 ymin: -89.99893 xmax: 180 ymax: 83.59961
## Geodetic CRS: WGS 84
## Flagged 4 records.
## Testing duplicates
## Flagged 65 records.
## Flagged 69 of 357 records, EQ = 0.19.
occ_data_sptlim_bias
## Simple feature collection with 288 features and 4 fields
## Geometry type: POINT
## Dimension: XY
## Bounding box: xmin: -72.71667 ymin: -12.21028 xmax: -43.9705 ymax: 2.584111
## Geodetic CRS: WGS 84
## # A tibble: 288 × 5
## lote sp latitude longitude geometry
## * <chr> <chr> <dbl> <dbl> <POINT [°]>
## 1 "UFRN 4729" Anablepsoides sp. -0.932 -48.1 (-48.09692 -0.931861)
## 2 "UFRN 5768" Anablepsoides sp. 2.58 -50.9 (-50.88047 2.584111)
## 3 "MPEG.ICT 027856" Anablepsoides urop… -5 -57.2 (-57.15 -5)
## 4 "\tMPEG.ICT 023420" Anablepsoides urop… -1.79 -51.6 (-51.62556 -1.788889)
## 5 "MPEG.ICT 027950" Anablepsoides urop… -5.7 -57.6 (-57.6 -5.7)
## 6 "\tMPEG.ICT 036343" Anablepsoides urop… -6.34 -49.9 (-49.87278 -6.336389)
## 7 "MPEG.ICT 030519" Anablepsoides urop… -2.60 -48.9 (-48.94194 -2.601389)
## 8 "FLMNH Ichthyology 189590" Anablepsoides urop… -1.85 -54.1 (-54.05544 -1.851167)
## 9 "MPEG.ICT 028548" Anablepsoides urop… -5.79 -57.4 (-57.45 -5.79)
## 10 "\tMPEG.ICT 036345" Anablepsoides urop… -6.27 -49.9 (-49.87194 -6.270833)
## # ℹ 278 more rows
# filtro de distância espacial
occ_data_sptlim_bias <- occ_data_sptlim_bias
occ_data_sptlim_bias <- occ_data_sptlim_bias %>%
mutate(genero = "anablepsoides")
filter_thin <- spThin::thin(loc.data = occ_data_sptlim_bias,
lat.col = "latitude",
long.col = "longitude",
spec.col = "genero",
thin.par = 50,
reps = 1,
write.files = FALSE,
write.log.file = FALSE,
locs.thinned.list.return = TRUE,
verbose = TRUE) %>%
.[[1]] %>%
tibble::as_tibble() %>%
dplyr::rename_with(tolower) %>%
dplyr::mutate(sptdist_filter = TRUE)
## **********************************************
## Beginning Spatial Thinning.
## Script Started at: Sat Nov 16 02:20:31 2024
## lat.long.thin.count
## 86
## 1
## [1] "Maximum number of records after thinning: 86"
## [1] "Number of data.frames with max records: 1"
## [1] "No files written for this run."
filter_thin
## # A tibble: 86 × 3
## longitude latitude sptdist_filter
## <dbl> <dbl> <lgl>
## 1 -48.1 -0.932 TRUE
## 2 -50.9 2.58 TRUE
## 3 -57.2 -5 TRUE
## 4 -51.6 -1.79 TRUE
## 5 -48.9 -2.60 TRUE
## 6 -57.7 -6.16 TRUE
## 7 -49.8 -6.35 TRUE
## 8 -48.4 -1.42 TRUE
## 9 -47.1 -1.58 TRUE
## 10 -47.1 -5.31 TRUE
## # ℹ 76 more rows
# join
occ_data_sptlim_bias_sptdist <- dplyr::left_join(
x = occ_data_sptlim_bias,
y = filter_thin,
by = c("longitude", "latitude")) %>%
filter(sptdist_filter)
occ_data_sptlim_bias_sptdist
## Simple feature collection with 88 features and 6 fields
## Geometry type: POINT
## Dimension: XY
## Bounding box: xmin: -72.71667 ymin: -12.21028 xmax: -44.03467 ymax: 2.584111
## Geodetic CRS: WGS 84
## # A tibble: 88 × 7
## lote sp latitude longitude geometry genero sptdist_filter
## * <chr> <chr> <dbl> <dbl> <POINT [°]> <chr> <lgl>
## 1 "UFRN 4729" Anab… -0.932 -48.1 (-48.09692 -0.931861) anablepso… TRUE
## 2 "UFRN 5768" Anab… 2.58 -50.9 (-50.88047 2.584111) anablepso… TRUE
## 3 "MPEG.ICT 027856" Anab… -5 -57.2 (-57.15 -5) anablepso… TRUE
## 4 "\tMPEG.ICT 02342… Anab… -1.79 -51.6 (-51.62556 -1.788889) anablepso… TRUE
## 5 "MPEG.ICT 030519" Anab… -2.60 -48.9 (-48.94194 -2.601389) anablepso… TRUE
## 6 "\tMPEG.ICT 02842… Anab… -6.16 -57.7 (-57.72 -6.161111) anablepso… TRUE
## 7 "\tMPEG.ICT 03634… Anab… -6.35 -49.8 (-49.82944 -6.348056) anablepso… TRUE
## 8 "ZUEC-PIS 14427" Anab… -1.42 -48.4 (-48.43333 -1.416667) anablepso… TRUE
## 9 "MPEG.ICT 018250" Anab… -1.58 -47.1 (-47.09139 -1.581944) anablepso… TRUE
## 10 "\tMPEG.ICT 02107… Anab… -5.31 -47.1 (-47.10222 -5.309167) anablepso… TRUE
## # ℹ 78 more rows
#Exportando os dados
# vetor
occ_data_filter %>%
sf::st_write("dados/ocorrencias/occ_anablep_data_filter_edit.shp" , delete_layer = TRUE)
## Deleting layer `occ_anablep_data_filter_edit' using driver `ESRI Shapefile'
## Writing layer `occ_anablep_data_filter_edit' to data source
## `dados/ocorrencias/occ_anablep_data_filter_edit.shp' using driver `ESRI Shapefile'
## Writing 89 features with 6 fields and geometry type Point.
# tabela
occ_data_filter %>%
sf::st_drop_geometry() %>%
readr::write_csv("dados/ocorrencias/occ_anablep_data_filter_edit.csv")
# ------Organizando para rodar os modelos ------
# Seleccionar occ
occ_sf <- st_read("./dados/ocorrencias/occ_anablep_data_filter_edit.shp")
## Reading layer `occ_anablep_data_filter_edit' from data source
## `C:\Users\Salu Coêlho\Documents\UFRN\LISE\Doutorado\Disciplinas\nicho_ecologico\salu_sdm_projeto_final\dados\ocorrencias\occ_anablep_data_filter_edit.shp'
## using driver `ESRI Shapefile'
## Simple feature collection with 89 features and 6 fields
## Geometry type: POINT
## Dimension: XY
## Bounding box: xmin: -72.71667 ymin: -12.21028 xmax: -44.05256 ymax: 2.584111
## Geodetic CRS: WGS 84
occ_data_ready <- as.data.frame(occ_sf) %>%
select(sptdst_,longitd,latitud)
# extrair coordenadas
coordinates(occ_data_ready) <- ~longitd + latitud
# map
tm_shape(amazonia) +
tm_polygons() +
tm_shape(occ_data_sptlim_bias_sptdist) +
tm_dots(size = .2, shape = 21, col = "steelblue")
occ_data_filter <- occ_data_sptlim_bias_sptdist
-Os Anablepsoides são conhecidos por serem associados também a microhabitas, pensando nesse sentido, a resolução das variáveis baixadas foi de 5 arcmin. - Foram utilizadas variáveis bioclimáticas do World Clim e identificada a seguinte matrix de correlação:
# download variables
env <- worldclim_global("bio", res = 5,
path = "dados/variaveis")
# rename
names(env)
## [1] "wc2.1_5m_bio_1" "wc2.1_5m_bio_2" "wc2.1_5m_bio_3" "wc2.1_5m_bio_4" "wc2.1_5m_bio_5"
## [6] "wc2.1_5m_bio_6" "wc2.1_5m_bio_7" "wc2.1_5m_bio_8" "wc2.1_5m_bio_9" "wc2.1_5m_bio_10"
## [11] "wc2.1_5m_bio_11" "wc2.1_5m_bio_12" "wc2.1_5m_bio_13" "wc2.1_5m_bio_14" "wc2.1_5m_bio_15"
## [16] "wc2.1_5m_bio_16" "wc2.1_5m_bio_17" "wc2.1_5m_bio_18" "wc2.1_5m_bio_19"
names(env) <- paste0("bio",1:19)
names(env)
## [1] "bio1" "bio2" "bio3" "bio4" "bio5" "bio6" "bio7" "bio8" "bio9" "bio10" "bio11"
## [12] "bio12" "bio13" "bio14" "bio15" "bio16" "bio17" "bio18" "bio19"
env
## class : SpatRaster
## dimensions : 2160, 4320, 19 (nrow, ncol, nlyr)
## resolution : 0.08333333, 0.08333333 (x, y)
## extent : -180, 180, -90, 90 (xmin, xmax, ymin, ymax)
## coord. ref. : lon/lat WGS 84 (EPSG:4326)
## sources : wc2.1_5m_bio_1.tif
## wc2.1_5m_bio_2.tif
## wc2.1_5m_bio_3.tif
## ... and 16 more source(s)
## names : bio1, bio2, bio3, bio4, bio5, bio6, ...
## min values : -54.73946, 1.00000, 9.063088, 0.000, -29.700, -72.501, ...
## max values : 31.05112, 21.73333, 100.000000, 2373.261, 48.265, 26.300, ...
# plot
plot(env$bio1)
# adjust extent and resolution
env_amazon <- env %>%
terra::crop(amazonia,mask = TRUE) #%>%
terra::aggregate(env_amazon, fact = .5/res(env)[1])
## class : SpatRaster
## dimensions : 44, 62, 19 (nrow, ncol, nlyr)
## resolution : 0.5, 0.5 (x, y)
## extent : -74, -43, -16.75, 5.25 (xmin, xmax, ymin, ymax)
## coord. ref. : lon/lat WGS 84 (EPSG:4326)
## source(s) : memory
## names : bio1, bio2, bio3, bio4, bio5, bio6, ...
## min values : 21.73885, 7.260254, 65.44985, 24.20681, 27.60569, 13.08058, ...
## max values : 27.74913, 14.373766, 90.97383, 172.61171, 36.11403, 22.86653, ...
env_amazon
## class : SpatRaster
## dimensions : 263, 367, 19 (nrow, ncol, nlyr)
## resolution : 0.08333333, 0.08333333 (x, y)
## extent : -74, -43.41667, -16.66667, 5.25 (xmin, xmax, ymin, ymax)
## coord. ref. : lon/lat WGS 84 (EPSG:4326)
## source(s) : memory
## names : bio1, bio2, bio3, bio4, bio5, bio6, ...
## min values : 18.63779, 6.64650, 64.72112, 22.32969, 24.561, 12.027, ...
## max values : 27.97633, 14.91967, 92.56153, 189.06963, 36.538, 23.600, ...
# plot
tm_shape(env_amazon$bio1) +
tm_raster(palette = "-RdBu", n = 10) +
tm_shape(amazonia) +
tm_borders(col = "black") +
tm_layout(legend.position = c("right", "bottom"))
# correlation
ENMTools::raster.cor.matrix(
env_amazon, method = "pearson")
## bio1 bio2 bio3 bio4 bio5 bio6 bio7
## bio1 1.0000000 -0.6126927 0.3343736 -0.26927561 0.19287785 0.7875535 -0.5533735
## bio2 -0.6126927 1.0000000 -0.6600437 0.39158635 0.52281575 -0.9408582 0.9592179
## bio3 0.3343736 -0.6600437 1.0000000 -0.40567919 -0.72653571 0.6922740 -0.8410852
## bio4 -0.2692756 0.3915863 -0.4056792 1.00000000 0.13766783 -0.4695378 0.4299211
## bio5 0.1928778 0.5228157 -0.7265357 0.13766783 1.00000000 -0.3223405 0.6535281
## bio6 0.7875535 -0.9408582 0.6922740 -0.46953779 -0.32234049 1.0000000 -0.9271603
## bio7 -0.5533735 0.9592179 -0.8410852 0.42992109 0.65352805 -0.9271603 1.0000000
## bio8 0.8883971 -0.4371494 0.2654363 -0.06551007 0.14207058 0.5717318 -0.4009156
## bio9 0.8884479 -0.7543945 0.4086361 -0.41096070 0.08870623 0.8996855 -0.6842622
## bio10 0.9674429 -0.5782222 0.2228993 -0.05512702 0.24141503 0.7311166 -0.4890371
## bio11 0.9478931 -0.6710437 0.3932622 -0.54473998 0.13542136 0.8411883 -0.6189996
## bio12 0.2672844 -0.4920626 0.5573079 -0.47278985 -0.39630149 0.4895946 -0.5483230
## bio13 0.2090951 -0.3081301 0.2161366 -0.18735828 -0.04920890 0.3443163 -0.2947851
## bio14 0.2968522 -0.5546841 0.7788539 -0.36432685 -0.57083988 0.5577794 -0.6719229
## bio15 -0.2575812 0.5404190 -0.6762688 0.41458895 0.55802520 -0.5108781 0.6293495
## bio16 0.1901015 -0.2679708 0.1754653 -0.22932057 -0.02270932 0.3016830 -0.2502081
## bio17 0.2905474 -0.5588170 0.7755791 -0.37894936 -0.57913037 0.5573564 -0.6748660
## bio18 -0.1778210 0.1724176 0.2157724 -0.02487348 -0.32003857 -0.2129327 0.0435886
## bio19 0.4601742 -0.6041030 0.3653416 -0.34162843 -0.06634217 0.6721169 -0.5636695
## bio8 bio9 bio10 bio11 bio12 bio13 bio14
## bio1 0.888397130 0.88844785 0.96744287 0.9478931 0.2672844 0.209095070 0.2968522
## bio2 -0.437149373 -0.75439454 -0.57822218 -0.6710437 -0.4920626 -0.308130107 -0.5546841
## bio3 0.265436327 0.40863606 0.22289935 0.3932622 0.5573079 0.216136619 0.7788539
## bio4 -0.065510067 -0.41096070 -0.05512702 -0.5447400 -0.4727898 -0.187358276 -0.3643269
## bio5 0.142070580 0.08870623 0.24141503 0.1354214 -0.3963015 -0.049208900 -0.5708399
## bio6 0.571731811 0.89968548 0.73111664 0.8411883 0.4895946 0.344316259 0.5577794
## bio7 -0.400915608 -0.68426221 -0.48903706 -0.6189996 -0.5483230 -0.294785128 -0.6719229
## bio8 1.000000000 0.61852459 0.86678257 0.7666423 0.2394310 0.008631732 0.3014056
## bio9 0.618524585 1.00000000 0.86104223 0.9226190 0.3236870 0.390660427 0.3212048
## bio10 0.866782571 0.86104223 1.00000000 0.8654294 0.1398726 0.198763045 0.1828591
## bio11 0.766642321 0.92261898 0.86542938 1.0000000 0.3537718 0.256599266 0.3406356
## bio12 0.239430959 0.32368699 0.13987256 0.3537718 1.0000000 0.471973714 0.7848510
## bio13 0.008631732 0.39066043 0.19876304 0.2565993 0.4719737 1.000000000 0.1118699
## bio14 0.301405600 0.32120483 0.18285908 0.3406356 0.7848510 0.111869871 1.0000000
## bio15 -0.311199627 -0.24964088 -0.13182142 -0.3191321 -0.7554489 0.097508842 -0.9168581
## bio16 0.003980497 0.34811013 0.16193297 0.2476578 0.5576548 0.951294575 0.1180153
## bio17 0.298067191 0.31426548 0.17323628 0.3393685 0.8044142 0.108435167 0.9961635
## bio18 0.115610462 -0.42429722 -0.27840047 -0.2070570 0.4437339 -0.280102280 0.4789684
## bio19 0.104070398 0.70212932 0.44993490 0.5375264 0.3138018 0.500212458 0.2733712
## bio15 bio16 bio17 bio18 bio19
## bio1 -0.25758115 0.190101543 0.2905474 -0.17782095 0.46017416
## bio2 0.54041900 -0.267970790 -0.5588170 0.17241761 -0.60410302
## bio3 -0.67626879 0.175465271 0.7755791 0.21577237 0.36534159
## bio4 0.41458895 -0.229320572 -0.3789494 -0.02487348 -0.34162843
## bio5 0.55802520 -0.022709321 -0.5791304 -0.32003857 -0.06634217
## bio6 -0.51087806 0.301683042 0.5573564 -0.21293269 0.67211693
## bio7 0.62934955 -0.250208134 -0.6748660 0.04358860 -0.56366947
## bio8 -0.31119963 0.003980497 0.2980672 0.11561046 0.10407040
## bio9 -0.24964088 0.348110125 0.3142655 -0.42429722 0.70212932
## bio10 -0.13182142 0.161932966 0.1732363 -0.27840047 0.44993490
## bio11 -0.31913212 0.247657753 0.3393685 -0.20705701 0.53752643
## bio12 -0.75544890 0.557654818 0.8044142 0.44373386 0.31380175
## bio13 0.09750884 0.951294575 0.1084352 -0.28010228 0.50021246
## bio14 -0.91685807 0.118015253 0.9961635 0.47896843 0.27337119
## bio15 1.00000000 0.061643318 -0.9343605 -0.56293868 -0.14577037
## bio16 0.06164332 1.000000000 0.1209007 -0.18506650 0.46869665
## bio17 -0.93436055 0.120900716 1.0000000 0.49508546 0.26633506
## bio18 -0.56293868 -0.185066496 0.4950855 1.00000000 -0.43631307
## bio19 -0.14577037 0.468696648 0.2663351 -0.43631307 1.00000000
ENMTools::raster.cor.plot(env_amazon)
## $cor.mds.plot
##
## $cor.heatmap
# pca
env_amazon_pca <- ade4::dudi.pca(env_amazon, center = TRUE,
scale = TRUE, scannf = FALSE,
nf = nlyr(env_amazon))
screeplot(env_amazon_pca, main = "Eigenvalues")
# vifstep
env_amazon_vifstep <- usdm::vifstep(env_amazon, th = 2)
env_amazon_vifstep
## 13 variables from the 19 input variables have collinearity problem:
##
## bio7 bio6 bio11 bio17 bio1 bio10 bio2 bio12 bio15 bio13 bio9 bio3 bio14
##
## After excluding the collinear variables, the linear correlation coefficients ranges between:
## min correlation ( bio16 ~ bio8 ): -0.007912595
## max correlation ( bio19 ~ bio16 ): 0.4507624
##
## ---------- VIFs of the remained variables --------
## Variables VIF
## 1 bio4 1.202480
## 2 bio5 1.266252
## 3 bio8 1.108971
## 4 bio16 1.277367
## 5 bio18 1.567917
## 6 bio19 1.833134
# vifcor
env_amazon_vifcor <- usdm::vifcor(env_amazon, th = .7)
env_amazon_vifcor
## 11 variables from the 19 input variables have collinearity problem:
##
## bio17 bio10 bio7 bio16 bio11 bio6 bio15 bio1 bio12 bio3 bio9
##
## After excluding the collinear variables, the linear correlation coefficients ranges between:
## min correlation ( bio18 ~ bio4 ): 0.0009517506
## max correlation ( bio19 ~ bio2 ): -0.6020426
##
## ---------- VIFs of the remained variables --------
## Variables VIF
## 1 bio2 8.618858
## 2 bio4 1.496518
## 3 bio5 5.237837
## 4 bio8 3.653362
## 5 bio13 1.326503
## 6 bio14 3.340424
## 7 bio18 3.415393
## 8 bio19 2.927320
# select
env_amazon_vif <- usdm::exclude(env_amazon, env_amazon_vifstep)
env_amazon_vif
## class : SpatRaster
## dimensions : 263, 367, 6 (nrow, ncol, nlyr)
## resolution : 0.08333333, 0.08333333 (x, y)
## extent : -74, -43.41667, -16.66667, 5.25 (xmin, xmax, ymin, ymax)
## coord. ref. : lon/lat WGS 84 (EPSG:4326)
## source(s) : memory
## names : bio4, bio5, bio8, bio16, bio18, bio19
## min values : 22.32969, 24.561, 18.42067, 580, 36, 12
## max values : 189.06963, 36.538, 27.91700, 1665, 920, 1665
env_amazon_cor <- usdm::exclude(env_amazon, env_amazon_vifcor)
env_amazon_cor
## class : SpatRaster
## dimensions : 263, 367, 8 (nrow, ncol, nlyr)
## resolution : 0.08333333, 0.08333333 (x, y)
## extent : -74, -43.41667, -16.66667, 5.25 (xmin, xmax, ymin, ymax)
## coord. ref. : lon/lat WGS 84 (EPSG:4326)
## source(s) : memory
## names : bio2, bio4, bio5, bio8, bio13, bio14, ...
## min values : 6.64650, 22.32969, 24.561, 18.42067, 196, 0, ...
## max values : 14.91967, 189.06963, 36.538, 27.91700, 596, 246, ...
env_amazon_vif_scale <- terra::scale(env_amazon_vif)
env_amazon_vif_scale
## class : SpatRaster
## dimensions : 263, 367, 6 (nrow, ncol, nlyr)
## resolution : 0.08333333, 0.08333333 (x, y)
## extent : -74, -43.41667, -16.66667, 5.25 (xmin, xmax, ymin, ymax)
## coord. ref. : lon/lat WGS 84 (EPSG:4326)
## source(s) : memory
## names : bio4, bio5, bio8, bio16, bio18, bio19
## min values : -1.462503, -7.128849, -10.569205, -3.018644, -2.016321, -1.671972
## max values : 6.844582, 3.618179, 3.292902, 6.591303, 2.849261, 2.972171
# plot
plot(env_amazon_vif, col = viridis::viridis(100))
plot(env_amazon_vif_scale, col = viridis::viridis(100))
#export
terra::writeRaster(x = env_amazon_vif_scale,
filename = paste0("dados/variaveis/", names(env_amazon_vif_scale), ".tif"),
overwrite = TRUE)
-Aqui foram construidos os modelos através dos algoritmos ‘GLM’,‘GAM’,‘ANN’ e ‘RF’ com o pacote BIOMOD
# Escolha os algoritmos a ser usados
mds_algo <- c('GLM','GAM',"ANN","RF")
# Número de repetições
n_rep <- 4 # Número de repetições que desejo (seleção aleatória de variáveis)
# Porcentagem de dados para amostra
data_sample <- 70
# Métrica de avaliação
eval_metric <- c("ROC","TSS")
# Opções globais BIOMOD_EnsembleModeling
# Limite de inclusão do modelo
model_thresh <- c(0.5,0.5)
biomod_data <- BIOMOD_FormatingData(
resp.var = occ_data_ready,
expl.var = env_amazon_vif_scale,
resp.name = "anablepsoides_amazonicos",
filter.raster = TRUE,
PA.nb.rep = 3, # NUmber of batch pseudo absent (at least 3)
PA.strategy = 'random',
dir.name = "C:/Users/Salu Coêlho/Documents/UFRN/LISE/Doutorado/Disciplinas/nicho_ecologico"
)
##
## -=-=-=-=-=-=-=-=-=-=-=-=-= anablepsoides_amazonicos Data Formating -=-=-=-=-=-=-=-=-=-=-=-=-=
##
## ! Response variable name was converted into anablepsoides.amazonicos
## !!! Some data are located in the same raster cell.
## Only the first data in each cell will be kept as `filter.raster = TRUE`.
##
## Checking Pseudo-absence selection arguments...
##
## > random pseudo absences selection
## > Pseudo absences are selected in explanatory variables
##
## ! No data has been set aside for modeling evaluation
## -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= Done -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
# Criar nosso modelo
biomod_model <- BIOMOD_Modeling(
bm.format = biomod_data,
models = mds_algo,
CV.strategy = "random", #crossvalidation
CV.perc = 0.7,
CV.nb.rep = 2,
metric.eval = c('TSS','ROC')
)
##
## -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= Build Single Models -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
##
##
## Checking Models arguments...
##
## > Automatic weights creation to rise a 0.5 prevalence
## Creating suitable Workdir...
##
##
## Checking Cross-Validation arguments...
##
## > Random cross-validation selection
##
## -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= Build Modeling Options -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
##
## > GLM options (datatype: binary , package: stats , function: glm )...
## > GAM options (datatype: binary , package: mgcv , function: gam )...
## > ANN options (datatype: binary , package: nnet , function: nnet )...
## > RF options (datatype: binary , package: randomForest , function: randomForest )...
##
## -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= Done -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
##
##
##
## -=-=-=-=-=-=-=-=-=-=-=-=-= anablepsoides.amazonicos Modeling Summary -=-=-=-=-=-=-=-=-=-=-=-=-=
##
## 6 environmental variables ( bio4 bio5 bio8 bio16 bio18 bio19 )
## Number of evaluation repetitions : 3.333333
## Models selected : GLM GAM ANN RF
##
## Total number of model runs: 40
##
## -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
##
##
## -=-=-=--=-=-=- anablepsoides.amazonicos_PA1_RUN1_GLM
##
## Evaluating Model stuff...
##
## -=-=-=--=-=-=- anablepsoides.amazonicos_PA1_RUN1_GAM
##
## Evaluating Model stuff...
##
## -=-=-=--=-=-=- anablepsoides.amazonicos_PA1_RUN1_ANN
## # weights: 17
## initial value 352.781662
## iter 10 value 298.285486
## iter 20 value 285.212035
## iter 30 value 277.170168
## iter 40 value 275.119866
## iter 50 value 274.369698
## iter 60 value 273.880065
## iter 70 value 273.723308
## iter 80 value 273.511336
## iter 90 value 271.579108
## iter 100 value 270.797389
## final value 270.797389
## stopped after 100 iterations
##
## Model scaling...
## Evaluating Model stuff...
##
## -=-=-=--=-=-=- anablepsoides.amazonicos_PA1_RUN1_RF
##
## Evaluating Model stuff...
##
## -=-=-=--=-=-=- anablepsoides.amazonicos_PA1_RUN2_GLM
##
## Evaluating Model stuff...
##
## -=-=-=--=-=-=- anablepsoides.amazonicos_PA1_RUN2_GAM
##
## Evaluating Model stuff...
##
## -=-=-=--=-=-=- anablepsoides.amazonicos_PA1_RUN2_ANN
## # weights: 17
## initial value 369.050718
## iter 10 value 296.650307
## iter 20 value 283.591134
## iter 30 value 260.261784
## iter 40 value 256.078568
## iter 50 value 253.597002
## iter 60 value 243.814346
## iter 70 value 241.989378
## iter 80 value 241.874113
## iter 90 value 241.850188
## iter 100 value 241.847427
## final value 241.847427
## stopped after 100 iterations
##
## Model scaling...
## Evaluating Model stuff...
##
## -=-=-=--=-=-=- anablepsoides.amazonicos_PA1_RUN2_RF
##
## Evaluating Model stuff...
##
## -=-=-=--=-=-=- anablepsoides.amazonicos_PA1_allRun_GLM
##
## Evaluating Model stuff...
##
## -=-=-=--=-=-=- anablepsoides.amazonicos_PA1_allRun_GAM
##
## Evaluating Model stuff...
##
## -=-=-=--=-=-=- anablepsoides.amazonicos_PA1_allRun_ANN
## # weights: 17
## initial value 519.742762
## iter 10 value 431.399706
## iter 20 value 417.978558
## iter 30 value 408.019262
## iter 40 value 402.636203
## iter 50 value 402.536970
## final value 402.536405
## converged
##
## Model scaling...
## Evaluating Model stuff...
##
## -=-=-=--=-=-=- anablepsoides.amazonicos_PA1_allRun_RF
##
## Evaluating Model stuff...
##
## -=-=-=--=-=-=- anablepsoides.amazonicos_PA2_RUN1_GLM
##
## Evaluating Model stuff...
##
## -=-=-=--=-=-=- anablepsoides.amazonicos_PA2_RUN1_GAM
##
## Evaluating Model stuff...
##
## -=-=-=--=-=-=- anablepsoides.amazonicos_PA2_RUN1_ANN
## # weights: 17
## initial value 378.187681
## iter 10 value 315.593274
## iter 20 value 296.676579
## iter 30 value 292.574540
## iter 40 value 289.750027
## iter 50 value 288.910930
## iter 60 value 275.918352
## iter 70 value 270.530415
## iter 80 value 267.681570
## iter 90 value 267.303735
## iter 100 value 267.008239
## final value 267.008239
## stopped after 100 iterations
##
## Model scaling...
## Evaluating Model stuff...
##
## -=-=-=--=-=-=- anablepsoides.amazonicos_PA2_RUN1_RF
##
## Evaluating Model stuff...
##
## -=-=-=--=-=-=- anablepsoides.amazonicos_PA2_RUN2_GLM
##
## Evaluating Model stuff...
##
## -=-=-=--=-=-=- anablepsoides.amazonicos_PA2_RUN2_GAM
##
## Evaluating Model stuff...
##
## -=-=-=--=-=-=- anablepsoides.amazonicos_PA2_RUN2_ANN
## # weights: 17
## initial value 361.996492
## iter 10 value 314.968284
## iter 20 value 288.625751
## iter 30 value 278.962744
## iter 40 value 276.810389
## iter 50 value 276.114225
## iter 60 value 274.849783
## iter 70 value 273.729593
## iter 80 value 273.393088
## iter 90 value 273.347443
## final value 273.343061
## converged
##
## Model scaling...
## Evaluating Model stuff...
##
## -=-=-=--=-=-=- anablepsoides.amazonicos_PA2_RUN2_RF
##
## Evaluating Model stuff...
##
## -=-=-=--=-=-=- anablepsoides.amazonicos_PA2_allRun_GLM
##
## Evaluating Model stuff...
##
## -=-=-=--=-=-=- anablepsoides.amazonicos_PA2_allRun_GAM
##
## Evaluating Model stuff...
##
## -=-=-=--=-=-=- anablepsoides.amazonicos_PA2_allRun_ANN
## # weights: 17
## initial value 541.656318
## iter 10 value 425.257089
## iter 20 value 421.109552
## iter 30 value 414.159803
## iter 40 value 398.013199
## iter 50 value 395.366150
## iter 60 value 389.484188
## iter 70 value 384.779330
## iter 80 value 384.696195
## iter 90 value 384.376176
## iter 100 value 384.363357
## final value 384.363357
## stopped after 100 iterations
##
## Model scaling...
## Evaluating Model stuff...
##
## -=-=-=--=-=-=- anablepsoides.amazonicos_PA2_allRun_RF
##
## Evaluating Model stuff...
##
## -=-=-=--=-=-=- anablepsoides.amazonicos_PA3_RUN1_GLM
##
## Evaluating Model stuff...
##
## -=-=-=--=-=-=- anablepsoides.amazonicos_PA3_RUN1_GAM
##
## Evaluating Model stuff...
##
## -=-=-=--=-=-=- anablepsoides.amazonicos_PA3_RUN1_ANN
## # weights: 17
## initial value 444.524437
## iter 10 value 302.316662
## iter 20 value 291.750587
## iter 30 value 286.714071
## iter 40 value 284.190892
## iter 50 value 283.702366
## iter 60 value 281.594314
## iter 70 value 281.203232
## iter 80 value 278.487383
## iter 90 value 276.744573
## iter 100 value 276.288814
## final value 276.288814
## stopped after 100 iterations
##
## Model scaling...
## Evaluating Model stuff...
##
## -=-=-=--=-=-=- anablepsoides.amazonicos_PA3_RUN1_RF
##
## Evaluating Model stuff...
##
## -=-=-=--=-=-=- anablepsoides.amazonicos_PA3_RUN2_GLM
##
## Evaluating Model stuff...
##
## -=-=-=--=-=-=- anablepsoides.amazonicos_PA3_RUN2_GAM
##
## Evaluating Model stuff...
##
## -=-=-=--=-=-=- anablepsoides.amazonicos_PA3_RUN2_ANN
## # weights: 17
## initial value 360.995875
## iter 10 value 298.831544
## iter 20 value 273.672955
## iter 30 value 261.920472
## iter 40 value 256.848906
## iter 50 value 255.824856
## iter 60 value 255.473938
## iter 70 value 252.990384
## iter 80 value 252.487396
## iter 90 value 252.370944
## iter 100 value 252.245807
## final value 252.245807
## stopped after 100 iterations
##
## Model scaling...
## Evaluating Model stuff...
##
## -=-=-=--=-=-=- anablepsoides.amazonicos_PA3_RUN2_RF
##
## Evaluating Model stuff...
##
## -=-=-=--=-=-=- anablepsoides.amazonicos_PA3_allRun_GLM
##
## Evaluating Model stuff...
##
## -=-=-=--=-=-=- anablepsoides.amazonicos_PA3_allRun_GAM
##
## Evaluating Model stuff...
##
## -=-=-=--=-=-=- anablepsoides.amazonicos_PA3_allRun_ANN
## # weights: 17
## initial value 499.530826
## iter 10 value 429.595643
## iter 20 value 399.543821
## iter 30 value 388.536765
## iter 40 value 380.254549
## iter 50 value 379.351414
## iter 60 value 379.019239
## iter 70 value 378.354037
## iter 80 value 373.095229
## iter 90 value 372.620277
## iter 100 value 372.601537
## final value 372.601537
## stopped after 100 iterations
##
## Model scaling...
## Evaluating Model stuff...
##
## -=-=-=--=-=-=- anablepsoides.amazonicos_PA3_allRun_RF
##
## Evaluating Model stuff...
##
## -=-=-=--=-=-=- anablepsoides.amazonicos_allData_allRun_GLM
##
## Evaluating Model stuff...
##
## -=-=-=--=-=-=- anablepsoides.amazonicos_allData_allRun_GAM
##
## Evaluating Model stuff...
##
## -=-=-=--=-=-=- anablepsoides.amazonicos_allData_allRun_ANN
## # weights: 17
## initial value 409.597009
## final value 86.000000
## converged
##
## Model scaling...
## *** single value predicted
## ! Note : anablepsoides.amazonicos_allData_allRun_ANN failed!
##
##
## -=-=-=--=-=-=- anablepsoides.amazonicos_allData_allRun_RF
##
## Evaluating Model stuff...
## -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= Done -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
# Plot response curve
# var_plot <-
as.data.frame(env_window$tab) %>%
filter(pred.val < 0.99 & pred.val > 0.1 # so os melhores
) %>%
group_by(expl.name,expl.val) %>%
summarise_at(vars(pred.val),
c(mean,sd),
na.rm = T) %>%
ggplot() +
geom_ribbon(
aes(
x = expl.val,
ymax = fn1+fn2,
ymin = fn1-fn2
),
fill = "grey"
) +
geom_line(
aes(
x = expl.val,
y = fn1
),
color = "black"
) +
theme_classic() +
labs(x = "Valores variavel explicativa",
y = "Valores preditos") +
facet_wrap(~expl.name, scales = "free", ncol = 3)
# Avaliar o performance do modelo
biomod_model_evaluation <- get_evaluations(biomod_model)
# Mostrar resultados
print(biomod_model_evaluation)
## full.name PA run algo metric.eval cutoff
## 1 anablepsoides.amazonicos_PA1_RUN1_GLM PA1 RUN1 GLM TSS 515.0
## 2 anablepsoides.amazonicos_PA1_RUN1_GLM PA1 RUN1 GLM ROC 522.5
## 3 anablepsoides.amazonicos_PA1_RUN1_GAM PA1 RUN1 GAM TSS 560.0
## 4 anablepsoides.amazonicos_PA1_RUN1_GAM PA1 RUN1 GAM ROC 553.5
## 5 anablepsoides.amazonicos_PA1_RUN1_ANN PA1 RUN1 ANN TSS 505.0
## 6 anablepsoides.amazonicos_PA1_RUN1_ANN PA1 RUN1 ANN ROC 505.5
## 7 anablepsoides.amazonicos_PA1_RUN1_RF PA1 RUN1 RF TSS 427.0
## 8 anablepsoides.amazonicos_PA1_RUN1_RF PA1 RUN1 RF ROC 426.0
## 9 anablepsoides.amazonicos_PA1_RUN2_GLM PA1 RUN2 GLM TSS 555.0
## 10 anablepsoides.amazonicos_PA1_RUN2_GLM PA1 RUN2 GLM ROC 555.0
## 11 anablepsoides.amazonicos_PA1_RUN2_GAM PA1 RUN2 GAM TSS 587.0
## 12 anablepsoides.amazonicos_PA1_RUN2_GAM PA1 RUN2 GAM ROC 582.5
## 13 anablepsoides.amazonicos_PA1_RUN2_ANN PA1 RUN2 ANN TSS 443.0
## 14 anablepsoides.amazonicos_PA1_RUN2_ANN PA1 RUN2 ANN ROC 628.5
## 15 anablepsoides.amazonicos_PA1_RUN2_RF PA1 RUN2 RF TSS 438.0
## 16 anablepsoides.amazonicos_PA1_RUN2_RF PA1 RUN2 RF ROC 438.0
## 17 anablepsoides.amazonicos_PA1_allRun_GLM PA1 allRun GLM TSS 539.0
## 18 anablepsoides.amazonicos_PA1_allRun_GLM PA1 allRun GLM ROC 556.5
## 19 anablepsoides.amazonicos_PA1_allRun_GAM PA1 allRun GAM TSS 581.0
## 20 anablepsoides.amazonicos_PA1_allRun_GAM PA1 allRun GAM ROC 584.5
## 21 anablepsoides.amazonicos_PA1_allRun_ANN PA1 allRun ANN TSS 472.0
## 22 anablepsoides.amazonicos_PA1_allRun_ANN PA1 allRun ANN ROC 473.5
## 23 anablepsoides.amazonicos_PA1_allRun_RF PA1 allRun RF TSS 391.0
## 24 anablepsoides.amazonicos_PA1_allRun_RF PA1 allRun RF ROC 390.0
## 25 anablepsoides.amazonicos_PA2_RUN1_GLM PA2 RUN1 GLM TSS 531.0
## 26 anablepsoides.amazonicos_PA2_RUN1_GLM PA2 RUN1 GLM ROC 535.5
## 27 anablepsoides.amazonicos_PA2_RUN1_GAM PA2 RUN1 GAM TSS 547.0
## 28 anablepsoides.amazonicos_PA2_RUN1_GAM PA2 RUN1 GAM ROC 532.5
## 29 anablepsoides.amazonicos_PA2_RUN1_ANN PA2 RUN1 ANN TSS 502.5
## 30 anablepsoides.amazonicos_PA2_RUN1_ANN PA2 RUN1 ANN ROC 503.0
## 31 anablepsoides.amazonicos_PA2_RUN1_RF PA2 RUN1 RF TSS 414.0
## 32 anablepsoides.amazonicos_PA2_RUN1_RF PA2 RUN1 RF ROC 413.0
## 33 anablepsoides.amazonicos_PA2_RUN2_GLM PA2 RUN2 GLM TSS 519.0
## 34 anablepsoides.amazonicos_PA2_RUN2_GLM PA2 RUN2 GLM ROC 580.5
## 35 anablepsoides.amazonicos_PA2_RUN2_GAM PA2 RUN2 GAM TSS 617.0
## 36 anablepsoides.amazonicos_PA2_RUN2_GAM PA2 RUN2 GAM ROC 598.0
## 37 anablepsoides.amazonicos_PA2_RUN2_ANN PA2 RUN2 ANN TSS 545.0
## 38 anablepsoides.amazonicos_PA2_RUN2_ANN PA2 RUN2 ANN ROC 545.0
## 39 anablepsoides.amazonicos_PA2_RUN2_RF PA2 RUN2 RF TSS 418.0
## 40 anablepsoides.amazonicos_PA2_RUN2_RF PA2 RUN2 RF ROC 419.0
## 41 anablepsoides.amazonicos_PA2_allRun_GLM PA2 allRun GLM TSS 511.0
## 42 anablepsoides.amazonicos_PA2_allRun_GLM PA2 allRun GLM ROC 496.0
## 43 anablepsoides.amazonicos_PA2_allRun_GAM PA2 allRun GAM TSS 596.0
## 44 anablepsoides.amazonicos_PA2_allRun_GAM PA2 allRun GAM ROC 600.5
## 45 anablepsoides.amazonicos_PA2_allRun_ANN PA2 allRun ANN TSS 516.0
## 46 anablepsoides.amazonicos_PA2_allRun_ANN PA2 allRun ANN ROC 516.0
## 47 anablepsoides.amazonicos_PA2_allRun_RF PA2 allRun RF TSS 428.0
## 48 anablepsoides.amazonicos_PA2_allRun_RF PA2 allRun RF ROC 429.0
## 49 anablepsoides.amazonicos_PA3_RUN1_GLM PA3 RUN1 GLM TSS 485.0
## 50 anablepsoides.amazonicos_PA3_RUN1_GLM PA3 RUN1 GLM ROC 489.0
## 51 anablepsoides.amazonicos_PA3_RUN1_GAM PA3 RUN1 GAM TSS 545.0
## 52 anablepsoides.amazonicos_PA3_RUN1_GAM PA3 RUN1 GAM ROC 552.0
## 53 anablepsoides.amazonicos_PA3_RUN1_ANN PA3 RUN1 ANN TSS 501.0
## 54 anablepsoides.amazonicos_PA3_RUN1_ANN PA3 RUN1 ANN ROC 505.5
## 55 anablepsoides.amazonicos_PA3_RUN1_RF PA3 RUN1 RF TSS 429.0
## 56 anablepsoides.amazonicos_PA3_RUN1_RF PA3 RUN1 RF ROC 428.0
## 57 anablepsoides.amazonicos_PA3_RUN2_GLM PA3 RUN2 GLM TSS 413.0
## 58 anablepsoides.amazonicos_PA3_RUN2_GLM PA3 RUN2 GLM ROC 418.0
## 59 anablepsoides.amazonicos_PA3_RUN2_GAM PA3 RUN2 GAM TSS 533.0
## 60 anablepsoides.amazonicos_PA3_RUN2_GAM PA3 RUN2 GAM ROC 586.5
## 61 anablepsoides.amazonicos_PA3_RUN2_ANN PA3 RUN2 ANN TSS 484.0
## 62 anablepsoides.amazonicos_PA3_RUN2_ANN PA3 RUN2 ANN ROC 495.5
## 63 anablepsoides.amazonicos_PA3_RUN2_RF PA3 RUN2 RF TSS 406.0
## 64 anablepsoides.amazonicos_PA3_RUN2_RF PA3 RUN2 RF ROC 404.0
## 65 anablepsoides.amazonicos_PA3_allRun_GLM PA3 allRun GLM TSS 492.0
## 66 anablepsoides.amazonicos_PA3_allRun_GLM PA3 allRun GLM ROC 510.5
## 67 anablepsoides.amazonicos_PA3_allRun_GAM PA3 allRun GAM TSS 597.0
## 68 anablepsoides.amazonicos_PA3_allRun_GAM PA3 allRun GAM ROC 597.5
## 69 anablepsoides.amazonicos_PA3_allRun_ANN PA3 allRun ANN TSS 546.0
## 70 anablepsoides.amazonicos_PA3_allRun_ANN PA3 allRun ANN ROC 545.5
## 71 anablepsoides.amazonicos_PA3_allRun_RF PA3 allRun RF TSS 428.0
## 72 anablepsoides.amazonicos_PA3_allRun_RF PA3 allRun RF ROC 428.0
## 73 anablepsoides.amazonicos_allData_allRun_GLM allData allRun GLM TSS 26.0
## 74 anablepsoides.amazonicos_allData_allRun_GLM allData allRun GLM ROC 32.5
## 75 anablepsoides.amazonicos_allData_allRun_GAM allData allRun GAM TSS 35.0
## 76 anablepsoides.amazonicos_allData_allRun_GAM allData allRun GAM ROC 35.5
## 77 anablepsoides.amazonicos_allData_allRun_RF allData allRun RF TSS 404.5
## 78 anablepsoides.amazonicos_allData_allRun_RF allData allRun RF ROC 405.0
## sensitivity specificity calibration validation evaluation
## 1 75.000 61.571 0.369 0.316 NA
## 2 75.000 62.857 0.727 0.713 NA
## 3 68.333 65.857 0.343 0.377 NA
## 4 70.000 64.429 0.708 0.708 NA
## 5 98.333 43.000 0.413 0.236 NA
## 6 98.333 43.000 0.723 0.694 NA
## 7 100.000 100.000 1.000 -0.013 NA
## 8 100.000 100.000 1.000 0.639 NA
## 9 73.333 69.571 0.429 0.158 NA
## 10 73.333 69.571 0.747 0.682 NA
## 11 71.667 69.286 0.414 0.290 NA
## 12 73.333 68.571 0.723 0.689 NA
## 13 93.333 59.286 0.526 0.075 NA
## 14 93.333 59.429 0.789 0.555 NA
## 15 100.000 100.000 1.000 -0.010 NA
## 16 100.000 100.000 1.000 0.638 NA
## 17 70.930 65.800 0.368 NA NA
## 18 68.605 69.000 0.732 NA NA
## 19 69.767 68.400 0.382 NA NA
## 20 69.767 68.900 0.714 NA NA
## 21 79.070 63.900 0.430 NA NA
## 22 79.070 63.900 0.749 NA NA
## 23 100.000 100.000 1.000 NA NA
## 24 100.000 100.000 1.000 NA NA
## 25 68.333 67.857 0.365 0.167 NA
## 26 68.333 68.286 0.737 0.667 NA
## 27 73.333 64.714 0.382 0.167 NA
## 28 75.000 63.429 0.736 0.658 NA
## 29 88.333 57.571 0.459 0.110 NA
## 30 88.333 57.571 0.724 0.594 NA
## 31 100.000 100.000 1.000 -0.017 NA
## 32 100.000 100.000 1.000 0.534 NA
## 33 71.667 61.286 0.331 0.414 NA
## 34 61.667 71.714 0.714 0.747 NA
## 35 60.000 73.714 0.339 0.352 NA
## 36 63.333 71.000 0.710 0.740 NA
## 37 78.333 64.857 0.432 0.423 NA
## 38 78.333 64.857 0.737 0.710 NA
## 39 100.000 100.000 1.000 0.060 NA
## 40 100.000 100.000 1.000 0.664 NA
## 41 73.256 62.000 0.356 NA NA
## 42 76.744 59.200 0.729 NA NA
## 43 63.953 70.700 0.349 NA NA
## 44 63.953 71.800 0.721 NA NA
## 45 77.907 67.500 0.454 NA NA
## 46 77.907 67.500 0.746 NA NA
## 47 100.000 100.000 1.000 NA NA
## 48 100.000 100.000 1.000 NA NA
## 49 76.667 57.857 0.347 0.298 NA
## 50 76.667 58.714 0.728 0.701 NA
## 51 70.000 63.429 0.336 0.284 NA
## 52 70.000 64.714 0.715 0.704 NA
## 53 80.000 62.714 0.427 0.139 NA
## 54 80.000 63.286 0.765 0.634 NA
## 55 100.000 100.000 1.000 -0.010 NA
## 56 100.000 100.000 1.000 0.671 NA
## 57 90.000 51.429 0.414 0.226 NA
## 58 90.000 51.857 0.739 0.650 NA
## 59 75.000 62.571 0.377 0.276 NA
## 60 68.333 70.286 0.730 0.659 NA
## 61 100.000 41.857 0.419 0.246 NA
## 62 80.000 63.857 0.767 0.686 NA
## 63 100.000 100.000 1.000 -0.027 NA
## 64 100.000 100.000 1.000 0.580 NA
## 65 77.907 56.400 0.345 NA NA
## 66 75.581 59.200 0.721 NA NA
## 67 65.116 69.700 0.352 NA NA
## 68 65.116 70.100 0.714 NA NA
## 69 75.581 67.200 0.428 NA NA
## 70 75.581 67.200 0.770 NA NA
## 71 100.000 100.000 1.000 NA NA
## 72 100.000 100.000 1.000 NA NA
## 73 77.907 56.276 0.358 NA NA
## 74 69.767 66.780 0.728 NA NA
## 75 70.930 64.393 0.365 NA NA
## 76 70.930 65.553 0.716 NA NA
## 77 100.000 100.000 1.000 NA NA
## 78 100.000 100.000 1.000 NA NA
## Plot de ROC and TSS
# Fazer figura TSS vs ROC
bm_PlotEvalMean(biomod_model)
## $tab
## name mean1 mean2 sd1 sd2
## 1 ANN 0.7522222 0.4431111 0.022309066 0.03448349
## 2 GAM 0.7187000 0.3639000 0.008857514 0.02480345
## 3 GLM 0.7302000 0.3682000 0.009295160 0.03060428
## 4 RF 1.0000000 1.0000000 0.000000000 0.00000000
##
## $plot
# Identificar os modelos que tiveram melhor performance
well_peform_m <- biomod_model_evaluation %>%
filter(validation >= 0.7) %>%
pull(full.name)
# Previsões usando os modelos treinados
predictions_biomod <- BIOMOD_Projection(
bm.mod = biomod_model,
models.chosen = well_peform_m,
new.env = env_amazon_vif_scale,
proj.name = "future_Prediction"
)
##
## -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= Do Single Models Projection -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
##
## > Building clamping mask
##
## > Projecting anablepsoides.amazonicos_PA1_RUN1_GLM ...
## > Projecting anablepsoides.amazonicos_PA1_RUN1_GAM ...
## > Projecting anablepsoides.amazonicos_PA2_RUN2_GLM ...
## > Projecting anablepsoides.amazonicos_PA2_RUN2_GAM ...
## > Projecting anablepsoides.amazonicos_PA2_RUN2_ANN ...
## > Projecting anablepsoides.amazonicos_PA3_RUN1_GLM ...
## > Projecting anablepsoides.amazonicos_PA3_RUN1_GAM ...
## -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= Done -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
-Predição final a partir do ensemble dos melhores modelos gerados - Essa predição nos indica que a distribuição dos Anablepsoides não seria uniforme ao longo do bioma amazônico, e sim associado algumas regiões, como nossa hipótese previa. Inclusive em uma área que se sobrepõe principalmente sobre partes dos rios Amazonas e sua foz, Madeira e Negro. Essas indicações podem ser úteis para entender e levantar hipóteses sobre questões biogeograficas do grupo.
model_ens <- BIOMOD_EnsembleModeling(
bm.mod = biomod_model,
models.chosen = well_peform_m,
metric.select = "TSS",
em.by = "all"
)
##
## -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= Build Ensemble Models -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
##
## ! setting em.algo to its default value c('EMmean')
## ! Ensemble Models will be filtered and/or weighted using validation dataset (if possible). Please use `metric.select.dataset` for alternative options.
## ! No metric.select.thresh -> All models will be kept for Ensemble Modeling
##
## > mergedData_mergedRun_mergedAlgo ensemble modeling
## ! Additional projection required for ensemble models merging several pseudo-absence dataset...
## -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= Do Single Models Projection -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
##
## > Projecting anablepsoides.amazonicos_PA1_RUN1_GLM ...
## > Projecting anablepsoides.amazonicos_PA1_RUN1_GAM ...
## -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= Done -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
##
## -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= Do Single Models Projection -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
##
## > Projecting anablepsoides.amazonicos_PA2_RUN2_GLM ...
## > Projecting anablepsoides.amazonicos_PA2_RUN2_GAM ...
## > Projecting anablepsoides.amazonicos_PA2_RUN2_ANN ...
## -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= Done -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
##
## -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= Do Single Models Projection -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
##
## > Projecting anablepsoides.amazonicos_PA3_RUN1_GLM ...
## > Projecting anablepsoides.amazonicos_PA3_RUN1_GAM ...
## -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= Done -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
##
##
## > Mean of probabilities by TSS ...
## Evaluating Model stuff...
## -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= Done -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
model_ens_proj <- BIOMOD_EnsembleForecasting(
bm.em = model_ens,
# bm.proj = biomod_model,
new.env = env_amazon_vif_scale,
proj.name = "ens_anablepsoides"
)
##
## -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= Do Ensemble Models Projection -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
##
## Creating suitable Workdir...
##
## -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= Do Single Models Projection -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
##
## > Projecting anablepsoides.amazonicos_PA1_RUN1_GLM ...
## > Projecting anablepsoides.amazonicos_PA1_RUN1_GAM ...
## > Projecting anablepsoides.amazonicos_PA2_RUN2_GLM ...
## > Projecting anablepsoides.amazonicos_PA2_RUN2_GAM ...
## > Projecting anablepsoides.amazonicos_PA2_RUN2_ANN ...
## > Projecting anablepsoides.amazonicos_PA3_RUN1_GLM ...
## > Projecting anablepsoides.amazonicos_PA3_RUN1_GAM ...
## -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= Done -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
##
## > Projecting anablepsoides.amazonicos_EMmeanByTSS_mergedData_mergedRun_mergedAlgo ...
## -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= Done -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
plot(model_ens_proj)
get_evaluations(model_ens)
## full.name merged.by.PA
## 1 anablepsoides.amazonicos_EMmeanByTSS_mergedData_mergedRun_mergedAlgo mergedData
## 2 anablepsoides.amazonicos_EMmeanByTSS_mergedData_mergedRun_mergedAlgo mergedData
## 3 anablepsoides.amazonicos_EMmeanByTSS_mergedData_mergedRun_mergedAlgo mergedData
## merged.by.run merged.by.algo filtered.by algo metric.eval cutoff sensitivity specificity
## 1 mergedRun mergedAlgo TSS EMmean KAPPA 659.0 41.860 84.072
## 2 mergedRun mergedAlgo TSS EMmean TSS 524.0 74.419 61.426
## 3 mergedRun mergedAlgo TSS EMmean ROC 428.5 86.047 50.341
## calibration validation evaluation
## 1 0.079 NA NA
## 2 0.361 NA NA
## 3 0.730 NA NA
env_window <- bm_PlotResponseCurves(
model_ens,
fixed.var = 'mean',
)
## | | | 0% | |============== | 17% | |============================ | 33% | |========================================== | 50% | |======================================================== | 67% | |====================================================================== | 83% | |====================================================================================| 100%
## No id variables; using all as measure variables